package top.kaoshanji.p2ch08c;

import java.lang.reflect.Proxy;

/**
 * 代码清单-p2ch08c-283页b：用来获取修改员工薪酬的代理对象的工厂类
 * author kaoshanji
 * ^_^
 * create time 2025/1/24 17:09
 */
public class EmployeeInfoManagerFactory {

    public EmployeeInfoManager getManager() {
        EmployeeInfoManager instance = new DefaultEmployeeInfoManager();
        return (EmployeeInfoManager)Proxy.newProxyInstance(instance.getClass().getClassLoader(),
                new Class[]{EmployeeInfoManager.class}, new AccessInvocationHandler<>(instance));

    }

}
